home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / DJGPP / BNU22SR2.ZIP / src / binutils.2 / libibert / makefile.in < prev    next >
Makefile  |  1993-05-30  |  8KB  |  247 lines

  1. #
  2. # Makefile
  3. #   Copyright (C) 1990, 1991, 1992 Free Software Foundation
  4. #
  5. # This file is part of the libiberty library.
  6. # Libiberty is free software; you can redistribute it and/or
  7. # modify it under the terms of the GNU Library General Public
  8. # License as published by the Free Software Foundation; either
  9. # version 2 of the License, or (at your option) any later version.
  10. #
  11. # Libiberty is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14. # Library General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU Library General Public
  17. # License along with libiberty; see the file COPYING.LIB.  If
  18. # not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  19. # Cambridge, MA 02139, USA.
  20. #
  21.  
  22. # This file was written, and is maintained by K. Richard Pixley
  23. # <rich@cygnus.com>.
  24.  
  25. #
  26. # Makefile for libiberty directory
  27. #
  28.  
  29. srcdir = .
  30.  
  31. prefix = /usr/local
  32.  
  33. exec_prefix = $(prefix)
  34. bindir = $(exec_prefix)/bin
  35. libdir = $(exec_prefix)/lib
  36.  
  37. datadir = $(prefix)/lib
  38.  
  39. mandir = $(prefix)/man
  40. man1dir = $(mandir)/man1
  41. man2dir = $(mandir)/man2
  42. man3dir = $(mandir)/man3
  43. man4dir = $(mandir)/man4
  44. man5dir = $(mandir)/man5
  45. man6dir = $(mandir)/man6
  46. man7dir = $(mandir)/man7
  47. man8dir = $(mandir)/man8
  48. man9dir = $(mandir)/man9
  49. infodir = $(prefix)/info
  50. includedir = $(prefix)/include
  51. oldincludedir =
  52. docdir = $(datadir)/doc
  53.  
  54. SHELL = /bin/sh
  55.  
  56. INSTALL = install -c
  57. INSTALL_PROGRAM = $(INSTALL)
  58. INSTALL_DATA = $(INSTALL)
  59.  
  60. AR = ar
  61. AR_FLAGS = rc
  62.  
  63. CFLAGS = -g
  64. BISON = bison
  65. MAKEINFO = makeinfo
  66. RANLIB = ranlib
  67.  
  68. MAKEOVERRIDES =
  69.  
  70. XTRAFLAGS =
  71.  
  72. TARGETLIB = libiberty.a
  73.  
  74. CONFIG_H = lconfig.h
  75. NEEDED_LIST = lneeded-list
  76.  
  77. # HOST_OFILES contains the list of objects that should be in the
  78. # library (in addition to the REQUIRED_OFILES and EXTRA_OFILES).
  79. # A configuration may override this with a fixed list a object files
  80. # names (hard to maintain), or some other way to generate a list.
  81. HOST_OFILES=`cat needed-list`
  82.  
  83. # Extra targets that the top-level target depends on.
  84. # Specifically, what needs to be made before HOST_OFILES can be used.
  85. # Can be empty if HOST_OFILES is just a list of file names.
  86. DO_ALSO = needed-list
  87.  
  88. # A configuration can specify extra .o files that should be included,
  89. # even if they are in libc. (Perhaps the libc version is buggy.)
  90. EXTRA_OFILES = 
  91.  
  92. all:    $(TARGETLIB)
  93. .PHONY: check installcheck
  94. check installcheck:
  95.  
  96.  
  97. #### Host, target, and site specific Makefile fragments come in here.
  98. ###
  99.  
  100. .c.o:
  101.     $(CC) -c $(CFLAGS) -I. -I$(srcdir)/../include $(HDEFINES) $(XTRAFLAGS) $<
  102.  
  103. # The default target just invokes make recursively.
  104. # However, the automatic configuration (in config/mh_default).
  105. # first causes it to figure out the objects missing in libc.
  106. info install-info clean-info dvi:
  107.  
  108. # NOTE: If you add new files to the library, edit 'functions.def'
  109. #       and add them to this list (alphabetical order please)
  110. CFILES = alloca.c argv.c basename.c bcmp.c bcopy.c bzero.c concat.c \
  111.      cplus-dem.c fdmatch.c getcwd.c getopt.c getopt1.c getpagesize.c \
  112.          ieee-float.c index.c insque.c \
  113.      memchr.c memcmp.c memcpy.c memmove.c memset.c \
  114.          obstack.c random.c rename.c rindex.c sigsetmask.c spaces.c \
  115.          strchr.c strdup.c strerror.c strrchr.c strsignal.c \
  116.          strstr.c strtod.c strtol.c strtoul.c tmpnam.c \
  117.      vfork.c vfprintf.c vprintf.c vsprintf.c
  118. # These are always included in the library.
  119. REQUIRED_OFILES = argv.o basename.o concat.o cplus-dem.o fdmatch.o \
  120.   getopt.o getopt1.o ieee-float.o obstack.o spaces.o strerror.o strsignal.o
  121.  
  122. # Do we want/need any config overrides?
  123. #     
  124.  
  125. STAGESTUFF = $(TARGETLIB) *.o
  126.  
  127. INSTALL_DEST = libdir
  128. install: install_to_$(INSTALL_DEST)
  129.  
  130. install_to_libdir: all
  131.     -parent=`echo $(libdir)|sed -e 's@/[^/]*$$@@'`; \
  132.     if [ -d $$parent ] ; then true ; else mkdir $$parent ; fi
  133.     -if [ -d $(libdir) ] ; then true ; else mkdir $(libdir) ; fi
  134.     $(INSTALL_DATA) $(TARGETLIB) $(libdir)/$(TARGETLIB).n
  135.     ( cd $(libdir) ; $(RANLIB) $(libdir)/$(TARGETLIB).n )
  136.     mv -f $(libdir)/$(TARGETLIB).n $(libdir)/$(TARGETLIB)
  137.  
  138. install_to_tooldir: all
  139.     -parent=`echo $(tooldir)|sed -e 's@/[^/]*$$@@'`; \
  140.     if [ -d $$parent ] ; then true ; else mkdir $$parent ; fi
  141.     -if [ -d $(tooldir) ] ; then true ; else mkdir $(tooldir) ; fi
  142.     -if [ -d $(tooldir)/lib ] ; then true ; else mkdir $(tooldir)/lib ; fi
  143.     $(INSTALL_DATA) $(TARGETLIB) $(tooldir)/lib/$(TARGETLIB).n
  144.     ( cd $(tooldir) ; $(RANLIB) $(tooldir)/lib/$(TARGETLIB).n )
  145.     mv -f $(tooldir)/lib/$(TARGETLIB).n $(tooldir)/lib/$(TARGETLIB)
  146.  
  147. # The default configuration adds to libiberty all those functions that are
  148. # missing in libc.  More precisely, it includes whatever $(CC) fails to find.
  149. # Then a sed+awk combination translates the ld error messages into
  150. # a list of .o files.
  151.  
  152. needed-list: $(NEEDED_LIST)
  153.     cp $(NEEDED_LIST) needed-list
  154.  
  155. lneeded-list: $(EXTRA_OFILES) needed.awk errors
  156.     awk -f needed.awk <errors >lneeded-list
  157.     echo $(EXTRA_OFILES) >>lneeded-list
  158.  
  159. # Generate an awk script that looks for functions in functions.def
  160.  
  161. needed.awk: $(srcdir)/functions.def Makefile
  162.     echo "# !Automatically generated from $(srcdir)/functions.def"\
  163.       "- DO NOT EDIT!" >needed.awk
  164.     grep '^DEF(' < $(srcdir)/functions.def \
  165.         | sed -e '/DEF/s|DEF.\([^,]*\).*|/\1/ { printf "\1.o " }|' \
  166.         >>needed.awk
  167.  
  168. config.h: $(CONFIG_H)
  169.     cp $(CONFIG_H) config.h
  170.  
  171. lconfig.h: needed2.awk errors
  172.     echo "/* !Automatically generated from $(srcdir)/functions.def"\
  173.       "- DO NOT EDIT! */" >lconfig.h
  174.     awk -f needed2.awk <errors >>lconfig.h
  175.  
  176. # Generate an awk script that looks for variables in functions.def
  177.  
  178. needed2.awk: $(srcdir)/functions.def Makefile
  179.     echo "# !Automatically generated from $(srcdir)/functions.def"\
  180.       "- DO NOT EDIT!" >needed2.awk
  181.     grep '^DEFVAR(' < $(srcdir)/functions.def \
  182.      | sed -e '/DEFVAR/s|DEFVAR.\([^,]*\).*|/\1/ { printf "#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' \
  183.      >>needed2.awk
  184.     grep '^DEFFUNC(' < $(srcdir)/functions.def \
  185.      | sed -e '/DEFFUNC/s|DEFFUNC.\([^,]*\).*|/\1/ { printf "#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' \
  186.      >>needed2.awk
  187.  
  188. dummy.o: $(srcdir)/dummy.c $(srcdir)/functions.def
  189.     $(CC) -c $(CFLAGS) -I. -I$(srcdir)/../include $(HDEFINES) $(XTRAFLAGS) $(srcdir)/dummy.c
  190.  
  191. errors: dummy.o $(EXTRA_OFILES)
  192.     -($(CC) -o dummy $(LDFLAGS) dummy.o $(EXTRA_OFILES) $(LOADLIBES)) >errors 2>&1 || true
  193.  
  194. $(HOST_OFILES) $(REQUIRED_OFILES) : config.h
  195.  
  196. RULE1 = $(TARGETLIB)
  197. $(RULE1): $(REQUIRED_OFILES) $(DO_ALSO) .always.
  198.     @$(MAKE) RULE1=not-used RULE2=$(TARGETLIB) \
  199.          HOST_OFILES="$(HOST_OFILES)" \
  200.         "CC=$(CC)" "CFLAGS=$(CFLAGS)" \
  201.         "AR=$(AR)" "AR_FLAGS=$(AR_FLAGS)" "RANLIB=$(RANLIB)" \
  202.         "XTRAFLAGS=$(XTRAFLAGS)"
  203.  
  204. # Rule invoked by recursive make in $(RULE1).
  205. RULE2 = not-used
  206. $(RULE2): $(REQUIRED_OFILES) $(HOST_OFILES)
  207.     rm -rf $(TARGETLIB)
  208.     $(AR) $(AR_FLAGS) $(TARGETLIB) \
  209.       $(REQUIRED_OFILES) $(HOST_OFILES)
  210.     $(RANLIB) $(TARGETLIB)
  211.  
  212. .always.:
  213. # Do nothing.
  214.  
  215. .PHONEY: all etags tags ls clean stage1 stage2 .always.
  216.  
  217. etags tags: TAGS
  218.  
  219. TAGS: $(CFILES)
  220.     etags $(HFILES) $(CFILES)
  221.  
  222. # Create a standalone demangler if so desired ("make demangle").
  223.  
  224. demangle: ${srcdir}/cplus-dem.c
  225.     $(CC) -o $@ -DMAIN $(CFLAGS) -I. -I$(srcdir)/../include $(HDEFINES) $(XTRAFLAGS) \
  226.       `echo ${srcdir}/cplus-dem.c | sed 's,^\./,,'`
  227.  
  228. ls:
  229.     @echo Makefile $(HFILES) $(CFILES)
  230.  
  231. # Need to deal with profiled libraries, too.
  232.  
  233. mostlyclean:
  234.     rm -f *.o core errs \#* *.E a.out
  235.     rm -f needed.awk needed2.awk errors dummy needed-list config.h
  236.     rm -f $(CONFIG_H) $(NEEDED_LIST)
  237. clean: mostlyclean
  238.     rm -f *.a
  239. distclean: clean
  240.     rm -f *~ Makefile config.status alloca-conf.h TAGS
  241. realclean: distclean
  242.  
  243. force:
  244.  
  245. Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
  246.     $(SHELL) ./config.status
  247.